﻿Public Class CIntrumentosValmer






    Public Sub New()
             
        InitializeComponent()
        CargarInstrumentos()  


    End Sub


    Private sub CargarInstrumentos()
         Dim app     As Application = DirectCast (Application.Current,Application  )
         Dim ventana As MainWindow  = app.Windows(0)
        

         Dim lstInstrumentosValmer As New List(Of CInstrumentosConsulta )
         Dim negocioValmer As New CValmerServicio ()
        
         lstInstrumentosValmer =   negocioValmer.ObtenerInstrumentosDecalog (ventana.paramEntreVentanasValmer.instrumento)       
         
         Me.lswInstrumentos.ItemsSource = lstInstrumentosValmer
         Me.lswInstrumentos.Items.Refresh () 
          
         If lstInstrumentosValmer.Count > 0 then 
            Me.lswInstrumentos.SelectedItem = Me.lswInstrumentos.Items (0)
            Me.lswInstrumentos.Focus ()
         End If


    End Sub




    Private Sub imgCancelar_MouseLeftButtonUp(ByVal sender As System.Object , ByVal e As System.Windows.Input.MouseButtonEventArgs) Handles imgCancelar.MouseLeftButtonUp
         Me.DialogResult = False 
         Me.Close ()         
    End Sub

    Private Sub imgAceptar_MouseLeftButtonUp(ByVal sender As System.Object , ByVal e As System.Windows.Input.MouseButtonEventArgs) Handles imgAceptar.MouseLeftButtonUp
         Dim app     As Application = DirectCast (Application.Current,Application  )
         Dim ventana As MainWindow  = app.Windows(0)

        
         Dim instrumento As CInstrumentosConsulta              
        
        If Not Me.lswInstrumentos.SelectedItem is Nothing then 
            instrumento = Me.lswInstrumentos.SelectedItem  
            ventana.paramEntreVentanasValmer.instrumento = instrumento.Instrumento 
            ventana.paramEntreVentanasValmer.numero  = instrumento.NumInstrumento 
        End If

           DialogResult = True  

    End Sub
End Class
